/*     */ package com.chw.admin.login;
/*     */ 
/*     */ import java.awt.Color;
/*     */ import java.awt.Font;
/*     */ import java.awt.Graphics;
/*     */ import java.awt.GraphicsEnvironment;
/*     */ import java.awt.image.BufferedImage;
/*     */ import java.util.HashSet;
/*     */ import java.util.Random;
/*     */ import java.util.Set;
/*     */ 
/*     */ public class Picture
/*     */ {
/*     */   private static final String CONTENT_TYPE = "text/html; charset=utf-8";
/*  14 */   private static Random random = new Random();
/*     */ 
/*  16 */   private static Font[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
/*     */ 
/*  18 */   private static Set excludeFonts = new HashSet();
/*     */   private static int imageWidth;
/*     */   private static int imageHeight;
/*     */   private static Color backgroundColor;
/*     */   private static int characterNumber;
/*  23 */   private StringBuffer keyBuf = null;
/*     */   private static Color[] colors;
/*     */ 
/*     */   private int randomX()
/*     */   {
/*  45 */     return random.nextInt(1) + 4;
/*     */   }
/*     */ 
/*     */   private int randomY() {
/*  49 */     return random.nextInt(1) + 18;
/*     */   }
/*     */ 
/*     */   private int randomSize() {
/*  53 */     return 18;
/*     */   }
/*     */ 
/*     */   private Font randomFont() {
/*  57 */     Font font = null;
/*     */ 
/*  59 */     font = new Font("Arial Black", 0, 18);
/*     */ 
/*  61 */     return font;
/*     */   }
/*     */ 
/*     */   private Color randomColor() {
/*  65 */     int index = random.nextInt(colors.length);
/*  66 */     return colors[index];
/*     */   }
/*     */ 
/*     */   private void drawCharacter(Graphics g, int x, int y, int random) {
/*  70 */     g.setColor(randomColor());
/*  71 */     g.setFont(randomFont());
/*  72 */     g.drawString(String.valueOf(random), x, y);
/*     */   }
/*     */ 
/*     */   public int getcharacterNumber() {
/*  76 */     return characterNumber;
/*     */   }
/*     */ 
/*     */   public void getcharacter(Graphics g, int offset, int random) {
/*  80 */     drawCharacter(g, randomX() + offset, randomY(), random);
/*     */   }
/*     */ 
/*     */   private void drawBackground(Graphics g, Color color, int x, int y, int width, int height) {
/*  84 */     g.setColor(color);
/*  85 */     g.fillRect(x, y, width, height);
/*     */   }
/*     */ 
/*     */   public void getbackground(Graphics g, int x, int y) {
/*  89 */     drawBackground(g, backgroundColor, x, y, imageWidth, imageHeight);
/*     */   }
/*     */ 
/*     */   private void drawInterrupt(Graphics g, int width, int height) {
/*  93 */     int numbers = random.nextInt(50) + 50;
/*  94 */     g.setColor(Color.BLACK);
/*  95 */     for (int i = 0; i < numbers; i++) {
/*  96 */       g.fillRect(random.nextInt(width), random.nextInt(height), 1, 1);
/*     */     }
/*  98 */     g.drawLine(0, random.nextInt(height), width, random.nextInt(height));
/*     */   }
/*     */ 
/*     */   public void getInterrupt(Graphics g) {
/* 102 */     drawInterrupt(g, imageWidth, imageHeight);
/*     */   }
/*     */ 
/*     */   public BufferedImage getBufferedImage() {
/* 106 */     BufferedImage image = new BufferedImage(imageWidth, imageHeight, 1);
/* 107 */     return image;
/*     */   }
/*     */ 
/*     */   static
/*     */   {
/*  27 */     excludeFonts.add("Cursor");
/*  28 */     excludeFonts.add("Marlett");
/*  29 */     excludeFonts.add("Symbol");
/*  30 */     excludeFonts.add("Webdings");
/*  31 */     excludeFonts.add("Wingdings");
/*  32 */     excludeFonts.add("Wingdings 2");
/*  33 */     imageWidth = 65;
/*     */ 
/*  35 */     imageHeight = 20;
/*     */ 
/*  37 */     backgroundColor = Color.WHITE;
/*     */ 
/*  39 */     characterNumber = 4;
/*     */ 
/*  41 */     colors = new Color[] { Color.RED, Color.RED, Color.RED, Color.RED, Color.RED, Color.RED, Color.RED, Color.RED };
/*     */   }
/*     */ }

/* Location:           E:\chenya\2017 4-21\com.chw\admin\login\
 * Qualified Name:     com.chw.admin.login.Picture
 * JD-Core Version:    0.6.0
 */